package com.lbb.waimai.utils;

import com.lbb.waimai.result.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = RuntimeException.class)
    public R handleException(RuntimeException e, HttpServletRequest request) {
        return R.error().message(e.getMessage());
    }

}
